/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath group: 'org.gradlefx', name: 'gradlefx', version: '1.5.0'
    }
}

plugins {
    id 'maven-publish'
    id 'signing'
}

apply plugin: 'gradlefx'

description = 'Apache Thrift ActionScript Library'
frameworkLinkage = 'none'
group = property('thrift.groupid')
srcDirs = ['src']
type = 'swc'

// We use the SNAPSHOT suffix for non-release versions
if (Boolean.parseBoolean(project.release)) {
    additionalCompilerOptions = ['-compiler.debug=false', '-compiler.strict=true']
    version = property('thrift.version')
} else {
    additionalCompilerOptions = ['-compiler.debug=true', '-compiler.strict=true']
    version = property('thrift.version') + '-SNAPSHOT'
}

defaultTasks 'compile'

// Keeping the rest of the build logic in functional named scripts for clarity
apply from: 'gradle/publishing.gradle'

