在自定义插件中使用`dependsOn`,Gradle

时间:2017-02-21 02:12:22

标签: gradle

可能重复:How to write dependsOn in Custom plugin

我有一个带有两个任务A和B的自定义Gradle插件。我在我的插件中声明了这两个任务:

project.task('A') << {      
   ....
}
project.task('B') << {      
   ....
}

如何创建任务B dependOn任务A?通常你可以说task myTask(dependsOn: 'myOtherTask'),但在插件中工作的语法要求似乎不允许这种类型的依赖声明。

1 个答案:

答案 0 :(得分:0)

{"total":1,"page":1,"records":1,"rows":[{"MobileID":12,"MobileName":"Lumia-730","MobileIMEno":"123456987","MobileManufactured":"Nokia","Mobileprice":15000}]}



 $(function () {
        $("#grid").jqGrid({
            url: "/Jqgrid/GetGridLists",
            datatype: 'json',
            mtype: 'Get',
            colNames: ['MobileID', 'MobileName', 'MobileIMEno', 'MobileManufactured', 'Mobileprice'],
            colModel: [
                { key: true, hidden: true, name: 'MobileID', index: 'MobileID', editable: true, search: true },
                { key: true, name: 'MobileName', index: 'MobileName', editable: true, search: true, stype: "text", formatter: formateadorLink },
                { key: true, name: 'MobileIMEno', index: 'MobileIMEno', editable: true, search: true, stype: "text" },
                { key: true, name: 'MobileManufactured', index: 'MobileManufactured', editable: true, search: true, stype: "text" },
                { key: true, name: 'Mobileprice', index: 'Mobileprice', editable: true, search: true, stype: "text" }
            ],
            pager: jQuery('#pager'),
            rowNum: 10,
            rowList: [10, 20, 30, 40],
            height: '100%',
            viewrecords: true,
            caption: 'Mobile List',

        emptyrecords: 'No records to display',
        jsonReader: {
            root: "rows",
            page: "page",
            total: "total",
            records: "records",
            repeatitems: false,
            Id: "0"
        },
        autowidth: true,
        multiselect: false,
        subGrid: true,

        subGridRowExpanded: function (subgrid_id, row_id) {
            var subgrid_table_id, pager_id;
            subgrid_table_id = subgrid_id + '_t';
            pager_id = "p_" + subgrid_table_id;
            $('#' + subgrid_id).html('<table id="' + subgrid_table_id + '" class="scroll"></table><div id="' + pager_id + '" class="scroll"></div>');
            $('#' + subgrid_table_id).jqGrid({
                url: '/Jqgrid/GetGridLists?id=' + row_id,
                datatype: 'json',
                mtype: 'POST',
                colNames: ['MobileID', 'MobileName', 'MobileIMEno', 'MobileManufactured', 'Mobileprice'],
                colModel: [
                   { key: true, hidden: true, name: 'MobileID', index: 'MobileID', editable: true, search: true },
                { key: true, name: 'MobileName', index: 'MobileName', editable: true, search: true, stype: "text" },
                { key: true, name: 'MobileIMEno', index: 'MobileIMEno', editable: true, search: true, stype: "text" },
                { key: true, name: 'MobileManufactured', index: 'MobileManufactured', editable: true, search: true, stype: "text" },
                { key: true, name: 'Mobileprice', index: 'Mobileprice', editable: true, search: true, stype: "text" }
                ],
                rowNum: 10,
                rowList: [10, 20, 30, 40],
                pager: pager_id,
                sortname: 'Bank',
                sortorder: 'asc',
                viewrecords: true,
                height: '100%',
                jsonReader: {
                    root: "rows",
                    page: "page",
                    total: "total",
                    records: "records",
                    repeatitems: false,
                    Id: "0"
                },
                autowidth: true,
                multiselect: false

            });
            $('#' + subgrid_table_id).jqGrid('navGrid', '#' + pager_id, { edit: false, add: false, del: false })
        }


    }).navGrid('#pager', { edit: true, add: true, del: true, search: true, refresh: true },
        {
            // edit options
            zIndex: 100,
            url: '/Jqgrid/Edit',
            closeOnEscape: true,
            closeAfterEdit: true,
            recreateForm: true,
            afterComplete: function (response) {
                if (response.responseText) {
                    alert(response.responseText);
                }
            }
        },
        {
            // add options
            zIndex: 100,
            url: "/Jqgrid/Create",
            closeOnEscape: true,
            closeAfterAdd: true,
            afterComplete: function (response) {
                if (response.responseText) {
                    alert(response.responseText);
                }
            }
        },
        {
            // delete options
            zIndex: 100,
            url: "/Jqgrid/Delete",
            closeOnEscape: true,
            closeAfterDelete: true,
            recreateForm: true,
            msg: "Are you sure you want to delete this task?",
            afterComplete: function (response) {
                if (response.responseText) {
                    alert(response.responseText);
                }
            }
        },
        {
            // Search options
            zIndex: 100,
            searchOnEnter: true,
            //url: "/Jqgrid/Search",
            closeOnEscape: true,
            closeAfterSearch: true,
            afterComplete: function (response) {
                if (response.responseText) {
                    alert(response.responseText);
                }
            }
        });

    jQuery('#grid').jqGrid('navButtonAdd', '#pager', {
        caption: "EXCEL", title: 'Export to EXCEL', onClickButton: function (e) {
            try {

                jQuery("#grid").jqGrid('excelExport', { tag: "Excel", url: '/Jqgrid/ExportToExcel' });
            } catch (e) {
            }
        }
    });

    jQuery('#grid').jqGrid('navButtonAdd', '#pager', {
        caption: "PDF", title: 'Export to PDF', onClickButton: function (e) {
            try {

                jQuery("#grid").jqGrid('excelExport', { tag: "PDF", url: 'Jqgrid/NewExportToPdf' });
            } catch (e) {
            }
        }
    });
});

function formateadorLink(cellvalue, options, rowObject) {

    return "<a href=/LinkGrid/GetGridLists/?value=" + cellvalue + ">" + cellvalue + "</a>";
}