ed * rpc_cred;
};

struct rpc_call_ops;
struct rpc_wait_queue;
struct rpc_wait {
 struct list_head list;
 struct list_head links;
 struct rpc_wait_queue * rpc_waitq;
};

struct rpc_task {
#ifdef RPC_DEBUG
 unsigned long tk_magic;
#endif
 atomic_t tk_count;
 struct list_head tk_task;
 struct rpc_clnt * tk_client;
 struct rpc_rqst * tk_rqstp;
 int tk_status;

 struct rpc_message tk_msg;
 __u8 tk_garb_retry;
 __u8 tk_cred_retry;

 unsigned long tk_cookie;

 void (*tk_timeout_fn)(struct rpc_task *);
 void (*tk_callback)(struct rpc_task *);
 void (*tk_action)(struct rpc_task *);
 const struct rpc_call_ops *tk_ops;
 void * tk_calldata;

 struct timer_list tk_timer;
 unsigned long tk_timeout;
 unsigned short tk_flags;
 unsigned char tk_priority : 2;
 unsigned long tk_runstate;
 struct workqueue_struct *tk_workqueue;
 union {
 struct work_struct tk_work;
 struct rpc_wait tk_wait;
 } u;

 unsigned short tk_timeouts;
 size_t tk_bytes_sent;
 unsigned long tk_start;
 long tk_rtt;

#ifdef RPC_DEBUG
 unsigned short tk_pid;
#endif
};
#define tk_auth tk_client->cl_auth
#define tk_xprt tk_client->cl_xprt

#define task_for_each(task, pos, head)   list_for_each(pos, head)   if ((task=list_entry(pos, struct rpc_task, u.tk_wait.list)),1)

#define task_for_first(task, head)   if (!list_empty(head) &&   ((task=list_entry((head)->next, struct rpc_task, u.tk_wait.list)),1))

#define alltask_for_each(task, pos, head)   list_for_each(pos, head)   if ((task=list_entry(pos, struct rpc_task, tk_task)),1)

typedef void (*rpc_action)(struct rpc_task *);

struct rpc_call_ops {
 void (*rpc_call_prepare)(struct rpc_task *, void *);
 void (*rpc_call_done)(struct rpc_task *, void *);
 void (*rpc_release)(void *);
};

#define RPC_TASK_ASYNC 0x0001  
#define RPC_TASK_SWAPPER 0x0002  
#define RPC_TASK_CHILD 0x0008  
#define RPC_CALL_MAJORSEEN 0x0020  
#define RPC_TASK_ROOTCREDS 0x0040  
#define RPC_TASK_DYNAMIC 0x0080  
#define RPC_TASK_KILLED 0x0100  
#define RPC_TASK_SOFT 0x0200  
#define RPC_TASK_NOINTR 0x0400  

#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
#define RPC_IS_CHILD(t) ((t)->tk_flags & RPC_TASK_CHILD)
#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
#define RPC_DO_ROOTOVERRIDE(t) ((t)->tk_flags & RPC_TASK_ROOTCREDS)
#define RPC_ASSASSINATED(t) ((t)->tk_flags & RPC_TASK_KILLED)
#define RPC_DO_CALLBACK(t) ((t)->tk_callback != NULL)
#define RPC_IS_SOFT(t) ((t)->tk_flags & RPC_TASK_SOFT)
#define RPC_TASK_UNINTERRUPTIBLE(t) ((t)->tk_flags & RPC_TASK_NOINTR)

#define RPC_TASK_RUNNING 0
#define RPC_TASK_QUEUED 1
#define RPC_TASK_WAKEUP 2
#define RPC_TASK_HAS_TIMER 3
#define RPC_TASK_ACTIVE 4

#define RPC_IS_RUNNING(t) (test_bit(RPC_TASK_RUNNING, &(t)->tk_runstate))
#define rpc_set_running(t) (set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate))
#define rpc_test_and_set_running(t)   (test_and_set_bit(RPC_TASK_RUNNING, &(t)->tk_runstate))
#define rpc_clear_running(t)   do {   smp_mb__before_clear_bit();   clear_bit(RPC_TASK_RUNNING, &(t)->tk_runstate);   smp_mb__after_clear_bit();   } while (0)

#define RPC_IS_QUEUED(t) (test_bit(RPC/*
 * Copyright 2012 the original author or authors.
 *
 * Licensed 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.
 */

package org.gradle.test.fixtures.maven

import org.gradle.test.fixtures.file.TestFile

/**
 * A fixture for dealing with the Maven Local cache.
 */
class MavenLocalRepository implements MavenRepository {

    final TestFile rootDir

    MavenLocalRepository(TestFile rootDir) {
        this.rootDir = rootDir
    }

    URI getUri() {
        return rootDir.toURI()
    }

    MavenLocalModule module(String groupId, String artifactId, Object version = '1.0') {
        def artifactDir = rootDir.file("${groupId.replace('.', '/')}/$artifactId/$version")
        return new MavenLocalModule(artifactDir, groupId, artifactId, version as String)
    }
}
