-
Notifications
You must be signed in to change notification settings - Fork 131
/
Copy pathbuild.gradle
47 lines (39 loc) · 1.1 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// -*- coding: utf-8; mode: groovy -*-
import com.amazonaws.services.s3.model.ObjectMetadata;
import jp.classmethod.aws.gradle.s3.CreateBucketTask;
import jp.classmethod.aws.gradle.s3.DeleteBucketTask;
import jp.classmethod.aws.gradle.s3.SyncTask;
buildscript {
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "jp.classmethod.aws:gradle-aws-plugin:0.+"
}
}
apply plugin: "jp.classmethod.aws.s3"
aws {
profileName = "default"
region = "ap-northeast-1"
}
task createBucket(type: CreateBucketTask) {
bucketName "gradle-aws-plugin-sample"
ifNotExists true
}
task deleteBucket(type: DeleteBucketTask) {
bucketName "gradle-aws-plugin-sample"
ifExists true
deleteObjects true
}
task syncContents(type: SyncTask, dependsOn: createBucket) {
source file("contents") // must be directory
bucketName "gradle-aws-plugin-sample"
prefix "02-s3-sync-contents/"
// to set all file's metadata "no-cache, no-store"
metadataProvider { bucket, key, file ->
ObjectMetadata m = new ObjectMetadata()
m.setCacheControl("no-cache, no-store")
return m
}
}