github.com/apache/beam/sdks/v2@v2.48.2/typescript/build.gradle (about)

     1  /*
     2   * Licensed to the Apache Software Foundation (ASF) under one
     3   * or more contributor license agreements.  See the NOTICE file
     4   * distributed with this work for additional information
     5   * regarding copyright ownership.  The ASF licenses this file
     6   * to you under the Apache License, Version 2.0 (the
     7   * License); you may not use this file except in compliance
     8   * with the License.  You may obtain a copy of the License at
     9   *
    10   *     http://www.apache.org/licenses/LICENSE-2.0
    11   *
    12   * Unless required by applicable law or agreed to in writing, software
    13   * distributed under the License is distributed on an AS IS BASIS,
    14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15   * See the License for the specific language governing permissions and
    16   * limitations under the License.
    17   */
    18  
    19  plugins { id 'org.apache.beam.module' }
    20  
    21  description = "Apache Beam :: SDKs :: Typescript"
    22  
    23  configurations {
    24    packTarball
    25  }
    26  
    27  def tarballName = "apache-beam.tgz"
    28  
    29  def typescriptSdkDeps = project.files(
    30            project.fileTree(
    31            dir: "${project.rootDir}",
    32            include: ['model/**', 'sdks/typescript/src/**', 'sdks/typescript/*.json'],
    33            // Exclude temporary directories and files that are generated
    34            // during build and test.
    35            exclude: [
    36              '**/build/**',
    37              '**/dist/**',
    38              '**/target/**',
    39              '**/.gogradle/**',
    40              '**/reports/test/index.html',
    41            ])
    42            )
    43  
    44  def pack = tasks.register("pack") {
    45  
    46    doLast {
    47      // Build artifact
    48      exec {
    49        executable 'sh'
    50        args '-c', "npm install && npm run build && npm pack --pack-destination ${buildDir}"
    51      }
    52  
    53      def collection = fileTree(buildDir){ include "**/*${project.version}*.tgz" exclude 'srcs/**'}
    54  
    55      // we need a fixed name for the artifact
    56      copy { from collection.singleFile; into buildDir; rename { tarballName } }
    57      logger.info('Create distribution tar file {} in {}', tarballName, buildDir)
    58    }
    59    inputs.files(typescriptSdkDeps)
    60        .withPropertyName('typescriptSdkDeps')
    61        .withPathSensitivity(PathSensitivity.RELATIVE)
    62    outputs.file "${buildDir}/${tarballName}"
    63  }
    64  
    65  artifacts {
    66    packTarball file: file("${buildDir}/${tarballName}"), builtBy: pack
    67  }